import { Component, OnInit, ViewChild, TemplateRef } from '@angular/core';
import { MenuItem } from '@iux/live';

@Component({
  templateUrl: './demo3.component.html'
})
export class Demo3Component implements OnInit {
  menus: MenuItem[];
  menus1: MenuItem[];

  @ViewChild('item2Tpl', { static: true}) item2Tpl: TemplateRef<any>;
  @ViewChild('item3Tpl', { static: true}) item3Tpl: TemplateRef<any>;

  ngOnInit() {
    this.menus = this.getMenus();
  }

  getMenus() {
    let data = [
      {
        id: '1',
        label: 'MenuItem 01'
      },
      {
        id: '2',
        label: this.item2Tpl,
      },
      {
        id: '3',
        label: 'MenuItem 03'
      },
      {
        id: '4',
        label: 'MenuItem 04'
      }
    ];

    this.menus1 = [
      {
        id: '1',
        label: 'MenuItem 01'
      },
      {
        id: '2',
        label: 'MenuItem 02'
      },
      {
        id: '3',
        label: this.item3Tpl
      },
      {
        id: '4',
        label: 'MenuItem 04'
      }
    ];
    return data;
  }
}